﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

// autoCAD Header
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.Runtime;

namespace _02AddEntityTools
{
    public class LineExam
    {
        [CommandMethod("LineExam")]
        public void lineDemo()
        {
            // 当前工作状态的图像数据库
            Database db = HostApplicationServices.WorkingDatabase;
            Line l1 = new Line(new Point3d(100, 100, 0), new Point3d(200, 200, 0));
            // 非静态调用方法
            //AddEntityTools add = new AddEntityTools();
            //add.addEntityToModelSpace(db, l1);
            // 静态调用方法
            db.addEntityToModelSpace(l1);
            Line l2 = new Line(new Point3d(100, 100, 0), new Point3d(110, 150, 0));
            Line l3 = new Line(new Point3d(100, 100, 0), new Point3d(120, 160, 0));
            Line l4 = new Line(new Point3d(100, 100, 0), new Point3d(130, 170, 0));
            Line l5 = new Line(new Point3d(100, 100, 0), new Point3d(140, 180, 0));
            Line l6 = new Line(new Point3d(100, 100, 0), new Point3d(150, 190, 0));
            db.addEntityToModelSpace(l2, l3, l4, l5, l6);

            db.addLineToModelSpace(new Point3d(500, 500, 0), new Point3d(500, 600, 0));
            db.addLineToModelSpace(new Point3d(500, 600, 0), 150, 90);
        }
    }
}
